import Taro, { Component, Config } from '@tarojs/taro'
import { Button, Image, ScrollView, Text, View } from '@tarojs/components'
import './index.scss'
import classNames from 'classnames'
import { AtInput, AtForm, AtIcon } from 'taro-ui'
import { FyImg } from '@/components/index'
import Greengou from "@/assets/images/greengou.png"
import Konggou from "@/assets/images/konggou.png"
export default class Index extends Component {
    state: any

    constructor(props) {
        super(props)

        this.state = {
            isLogin: false,
            authinfo: {
                phone: '',
                tuxingma: '',
                code: ''
            },
            isagree: false,
        }
    }
    changePhone() { }

    agree() {
        this.setState({
            isagree: !this.state.isagree
        })
    }

    back(){
        Taro.navigateBack()
    }

    render() {
        const { isLogin, authinfo, isagree } = this.state
        return (
            <View className='user-auth'>
                <View className="top-title"> 点击获取验证码，确认授权后进行查询 </View>
                <View className="mall-container">
                    <AtForm style="width:90%;">
                        <AtInput
                            name='phone'
                            title='手机号'
                            type='text'
                            placeholder='请输入手机号'
                            value={authinfo.phone}
                        />
                        <AtInput
                            name='tuxingma'
                            title='图形码'
                            type='text'
                            placeholder='请输入图形码'
                            value={authinfo.tuxingma}
                        />
                        <AtInput
                            name='code'
                            title='验证码'
                            type='number'
                            placeholder='请输入验证码'
                            value={authinfo.code}
                        />
                    </AtForm>
                </View>
                <View className="sure-auth">
                    <View className="submit-btn">确认授权</View>
                </View>
                <View className="agree">
                    {isagree && <FyImg src={Greengou} className="check-circle" onClick={this.agree.bind(this)} />}
                    {!isagree && <FyImg src={Konggou} className="check-circle" onClick={this.agree.bind(this)} />}
                    <View style="margin-left:10px;" >确认绑定代表您已同意 《隐私协议》</View>
                </View>
                <View className="back">
                    <View className="back-btn" onClick={this.back.bind(this)}>返回</View>
                </View>
            </View>
        )
    }
}